package com.xgkj.diyiketang.activity;

import android.content.Context;
import android.os.Bundle;
import android.text.LoginFilter;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.xgkj.diyiketang.R;
import com.xgkj.diyiketang.data.EatShowUserInfo;
import com.xgkj.diyiketang.http.engine.ShowToastTaskEventListener;
import com.xgkj.diyiketang.task.GetUserDetailTask;
import com.xgkj.diyiketang.util.ToastUtil;

public class VipShouYiActivity extends BaseActivity {

    private TextView mHuaduoyueTv;
    private String mVipFlower;
    private TextView mBackF;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mVipFlower = getIntent().getStringExtra("vipflower");
        Log.e("mVipFlower3:",""+mVipFlower);
        //SgetUserInfoIsLive();
        setContentView(R.layout.activity_vip_shou_yi);

        initView();
    }

    private void initView() {
        mHuaduoyueTv = (TextView) findViewById(R.id.huaduoyue);
        Log.e("mVipFlower2:",mVipFlower+"");
      mHuaduoyueTv.setText("❀"+mVipFlower);
        mBackF = (TextView) findViewById(R.id.back);
        mBackF.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                VipShouYiActivity.this.finish();
            }
        });
    }


    private int isLive = -1;
    /*直播的 判断方法请求*/
    public void getUserInfoIsLive() {
        GetUserDetailTask task = new GetUserDetailTask();
        task.addListener(new ForgetUserInfoTaskEventListener(mContext));
        isLive = getEatShowApp().getTaskManager().addTask(task);

    }

    class ForgetUserInfoTaskEventListener extends ShowToastTaskEventListener {
        public ForgetUserInfoTaskEventListener (Context context) {
            super(context);
        }

        @Override
        public void handleTaskCompleted(int taskId, int result, Object data) {
            super.handleTaskCompleted(taskId, result, data);
            if(taskId == isLive) {
                isLive = -1;

                Log.e("taskId:+result:+data::","taskId"+taskId+"++"+result+":::"+data.toString());
                // EatShowApp data1 = (EatShowApp) data;
                EatShowUserInfo data1 = (EatShowUserInfo) data;
                //canStartLive = data1.getCanStartLive();
               // mIsVip = data1.isVip();
               // mVipFlower = data1.getVipFlower();
                      // Log.e("mVipFlower::;",mVipFlower+"");
                if(getEatShowApp().getmUserInfo()!=null){
                    // getEatShowApp().getmUserInfo().setCanStartLive(canStartLive);

                }

            }
        }

        @Override
        public void handleTaskError(int taskId, int errorCode, String errorMsg) {
            super.handleTaskError(taskId, errorCode, errorMsg);
        }
    }
}
